{{extend './base.html'}}
{{block 'titleBlock'}}商品详情页{{/block}}
{{block 'scriptBlock'}}
<script type="text/javascript" src="/js/web_detail.js"></script>
{{/block}}
{{block 'contentBlock'}}
<div class="container">
    <div class="show_left">
        <div class="merchant">
            <a href="/web_merchant/{{merchantInfo.user_id}}">
            <div class="merchant_img">
                <img src="{{merchantInfo.head_url}}" alt="">
            </div>
            <div class="merchant_name">
                {{merchantInfo.nick_name}}
            </div>
            <div class="merchant_abstract">
                {{merchantInfo.abstract}}
            </div>
            </a>
            <div class="merchant_private_letter">
                <a href="javascript:;">私信</a>
                <script>
                    $(function() {
                        $(".merchant_private_letter a").click(function(e){
                            e.preventDefault()
                            location.href="/web_private_letter/?merchant_id={{merchantInfo.user_id}}&user_id={{user_info.user_id}}"
                        });
                    });
                </script>
            </div>
            <div class="merchant_concern">
                <button class="concern" style="display: {{isFollow?'none':'block'}}" data-userid="{{merchantInfo.user_id}}">关注</button>
                <button class="concerned" style="display: {{isFollow?'block':'none'}}" data-userid="{{merchantInfo.user_id}}"><span class="out">已关注</span><span class="over">取消关注</span></button>
            </div>
        </div>
        <div class="commodity">
            <div class="commodity_img">
                <img src="{{commodityId.commodity_url}}" alt="">
            </div>
            <div class="commodity_name">
                <p class="p1">{{commodityId.commodity_name}}</p>
                <p class="p2">单价：￥{{commodityId.unit_price}}</p>
                <p class="p2">数量：
                    <img src="/images/del.jpg" alt="" class="img_del">
                    <span class="number">1</span>
                    <img src="/images/add.jpg" alt="" class="img_add">
                </p>
                <button class="commodity_addcart" commodity_id="{{commodityId.commodity_id}}">加入购物车</button>
                <a href="javascript:;"  class="commodity_add">购买</a>
                <script>
                    $(function() {
                        $(".commodity_add").click(function(e){
                            e.preventDefault()
                            var commodity_number=$(".number").html()
                            location.href="/web_commodity_pay/?commodity_id={{commodityId.commodity_id}}&commodity_number="+commodity_number
                        });
                    });
                </script>
            </div>
            <div class="commodity_collect">
                <button class="collect" data-commodityid="{{commodityId.commodity_id}}" style="display: {{isCollected?'none':'block'}}">★ 收藏</button>
                <button class="collected"  data-commodityid="{{commodityId.commodity_id}}" style="display: {{isCollected?'block':'none'}}"><span class="out">★ 已收藏</span><span class="over">★ 取消收藏</span></button>
            </div>
            <div class="commodity_abstract">
                简介:{{commodityId.abstract}}
            </div>
        </div>
        <div class="comment">
            {{if !user_info}}
            <div class="comment_form_logout">
                登录发表你的评论
            </div>
            {{else}}

            <form action="" class="comment_form" data-commodityid="{{commodityId.commodity_id}}">
                <div class="person_pic">
                    <img src="{{user_info.head_url}}" alt="用户图标">
                </div>
                <textarea placeholder="请发表您的评论" class="comment_input"></textarea>
                <input type="submit" name="" value="评 论" class="comment_sub">
            </form>
            {{/if}}

            <div class="comment_count">
                {{commentCounts}}条评论
            </div>

            <div class="comment_list_con">
                {{each commentInfo}}
                <div class="comment_list">
                    <div class="person_pic fl">
                        <img src="{{$value.commenter.head_url}}" alt="用户图标">
                    </div>    
                    <div class="user_name fl">{{$value.commenter.nick_name}}</div>
                    <div class="comment_text fl">
                        {{$value.content}}
                    </div>
                    {{if $value.parent_id}}
                    <div class="reply_text_con fl">
                        <div class="user_name2">{{$value.parent.user.nick_name}}</div>
                        <div class="reply_text">
                            {{$value.parent.content}}
                        </div>
                    </div>
                    {{/if}}
                    <div class="comment_time fl">{{$value.create_time | dateFormat}}</div>
                    <a href="javascript:;" class="{{user_like_comments_ids.indexOf($value.comment_id)>=0?'has_comment_up':''}} comment_up fr" data-commodityid="{{$value.commodity_id}}" data-commentid="{{$value.comment_id}}" data-likecount="{{ $value.like_num?$value.like_num:0}}">{{ $value.like_num?$value.like_num:"赞"}}</a>
                    <a href="javascript:;" class="comment_reply fr">回复</a>
                    <from class="reply_form fl" data-commodityid="{{$value.commodity_id}}" data-commentid="{{$value.comment_id}}">
                        <textarea  class="reply_input"></textarea>
                        <input type="submit" name="" value="回复" class="reply_sub fr">
                        <input type="reset" name="" value="取消" class="reply_cancel fr">
                    </from>            
                </div>
                {{/each}}
            </div>
        </div>
    </div>
    <div class="show_right">
        <ul>
            <li>销量排行</li>
            {{each salesOrder}}
            <li>
                <span class="rank_{{$index+1}}">{{$index+1}}</span>
                <a href="/commodity_detail/{{$value.commodity_id}}">{{$value.commodity_name}}</a>
            </li>
            {{/each}}
        </ul>
    </div>
</div>
{{/block}}